G.cart.comm = {

    submit: function() {

        E.loadding.open("正在跳转，请稍候...");

        self.location = G.args.checkout + '?emt=0.0.3.4.0.4';

    }

};

//删除普通商品
G.cart.general.del = function( id ) {
    this.postID = id;
    E.confirm("您确认删除该商品吗？", "G.cart.general.confirmDel");
}

G.cart.general.confirmDel = function() {
    E.loadding.open("正在删除购物车商品，请稍候...");
    E.ajax_get({
        action: "cart",
        operFlg: 4,
        data: {
            postID: this.postID
        },
        call: "G.cart.general.result"
    });
}


//更新普通商品数量
G.cart.general.update = function(postID, amount) {
    this.postID = postID;
    this.amount = amount;
    var current_amount = $("#goods_amount_" + postID).val();
    if (parseInt(amount) + parseInt(current_amount) == 0) {
        E.confirm("您确认删除该商品吗？", "G.cart.general.confirmDel");
    } else {
        E.loadding.open("正在修改商品数量，请稍候...");
        E.ajax_get({
            action: "cart",
            operFlg: 3,
            data: {
                postID: this.postID,
                goods_amount: this.amount
            },
            call: "G.cart.general.result"
        });
    }
}

//清空购物车
G.cart.general.emptyCart = function() {
    E.confirm("您确认清空购物车吗？", "G.cart.general.confirmEmpty");
}

G.cart.general.confirmEmpty = function () {
    E.loadding.open("正在清空购物车，请稍候...");
    E.ajax_get({
        action: "cart",
        operFlg: 5,
        call: "G.cart.general.result"
    });
}

/**
 * 积分商品
 */
G.cart.points = {
	
	//商品网购号
	postID:'',
	
	//商品数量
	amount:'',
	
	//更新
	update: function(postID, amount) {
		this.postID = postID;
	    this.amount = amount;
	    var current_amount = $("#goods_amount_" + postID).val();
	    if (parseInt(amount) + parseInt(current_amount) == 0) {
	        E.confirm("您确认删除该商品吗？", "G.cart.points.confirmDel");
	    } else {
	        E.loadding.open("正在修改商品数量，请稍候...");
	        E.ajax_get({
	            action: "cart",
	            operFlg: 13,
	            data: {
	                postID: this.postID,
	                goods_amount: this.amount
	            },
	            call: "G.cart.general.result"
	        });
	    }
	},
	
	//删除
	del: function( id ) {
		this.postID = id;
	    E.confirm("您确认删除该良票商品吗？", "G.cart.points.confirmDel");	
	},
	
	//确认删除
	confirmDel: function(){
		E.loadding.open("正在删除购物车商品，请稍候...");
	    E.ajax_get({
	        action: "cart",
	        operFlg: 15,
	        data: {
	            postID: this.postID
	        },
	        call: "G.cart.general.result"
	    });
	}
	
}